<%= simple_form_for([:admin, @article], html: {class: 'layui-form'}) do |f| %>
  <%= f.error_notification %>

    <div class="layui-form-item">
      <%= f.label :thumbnail_img, class: 'layui-form-label' %>
      <div class="layui-input-block">
        <%= f.input_field :thumbnail_img, as: :file, class: 'layui-input', autocomplete: 'off', placeholder: Article.human_attribute_name(:thumbnail_img) %>
      </div>
      <span>建议大小420x294</span>
    </div>
    <div class="layui-form-item">
      <%= f.label :title, class: 'layui-form-label' %>
      <div class="layui-input-block">
        <%= f.input_field :title, class: 'layui-input', autocomplete: 'off', placeholder: Article.human_attribute_name(:title) %>
      </div>
    </div>
    <div class="layui-form-item">
      <%= f.label :brief, class: 'layui-form-label' %>
      <div class="layui-input-block">
        <%= f.input_field :brief, class: 'layui-input', autocomplete: 'off', placeholder: Article.human_attribute_name(:brief) %>
      </div>
    </div>

    <div class="layui-form-item">
      <%= f.label :content, class: 'layui-form-label' %>
      <div class="layui-input-block">
        <%= f.text_area :content, class: 'layui-input', autocomplete: 'off', placeholder: Article.human_attribute_name(:content) %>
      </div>
    </div>
    <div class="layui-form-item">
      <%= f.label :tags, class: 'layui-form-label' %>
      <div class="layui-input-block">
        <%= f.input_field :tags, class: 'layui-input', autocomplete: 'off', placeholder: Article.human_attribute_name(:tags) %>
      </div>
    </div>
    <div class="layui-form-item">
      <%= f.label :article_category_id, class: 'layui-form-label' %>
      <div class="layui-input-block">
        <%= f.input_field :article_category_id, collection: ArticleCategory.pluck(:title, :id), class: 'layui-input', autocomplete: 'off', placeholder: Article.human_attribute_name(:article_category_id) %>
      </div>
    </div>
    <div class="layui-form-item" style="display: none">
      <%= f.label :admin_user_id, class: 'layui-form-label' %>
      <div class="layui-input-block">
        <%= f.input_field :admin_user_id, class: 'layui-input', autocomplete: 'off', placeholder: Article.human_attribute_name(:admin_user_id) %>
      </div>
    </div>
    <div class="layui-form-item" style="display: none">
      <%= f.label :company_id, class: 'layui-form-label' %>
      <div class="layui-input-block">
        <%= f.input_field :company_id, class: 'layui-input', autocomplete: 'off', placeholder: Article.human_attribute_name(:company_id) %>
      </div>
    </div>

  <div class="actions">
    <%= f.submit t('buttons.save'), data: { disable_with: "保存中..." }, class: 'layui-btn' %>
    <%= link_to t('buttons.cancel'), url_for(:back), class: 'layui-btn layui-btn-normal' %>
  </div>
<% end %>

<script>
  BuildFroalaEditor('#article_content');
</script>